home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 359_11 / patch5.000 / EMU387_E55.CC < prev    next >
C/C++ Source or Header  |  1991-09-11  |  814b  |  50 lines

  1. #include "emu.h"
  2. #include "rmov.h"
  3. #include "compare.h"
  4.  
  5. void emu_55()
  6. {
  7.   if (empty())
  8.     return;
  9.   if (modrm > 0277)
  10.   {
  11.     // fucomp st(i)
  12.     if (empty(modrm&7))
  13.     {
  14.       setcc(SW_C3|SW_C2|SW_C0);
  15.       return;
  16.     }
  17.     int c = compare(st(), st(modrm&7));
  18.     st().tag = TW_E;
  19.     top++;
  20.     int f;
  21.     if (c & COMP_SNAN)
  22.     {
  23.       exception(EX_I);
  24.       f = SW_C3 | SW_C2 | SW_C0;
  25.     }
  26.     else
  27.       switch (c)
  28.       {
  29.         case COMP_A_LT_B:
  30.           f = SW_C0;
  31.           break;
  32.         case COMP_A_EQ_B:
  33.           f = SW_C3;
  34.           break;
  35.         case COMP_A_GT_B:
  36.           f = 0;
  37.           break;
  38.         case COMP_NOCOMP:
  39.           f = SW_C3 | SW_C2 | SW_C0;
  40.           break;
  41.       }
  42.     setcc(f);
  43.     
  44.   }
  45.   else
  46.   {
  47.     emu_bad();
  48.   }
  49. }
  50.